﻿/*
 * Created by SharpDevelop.
 * User: 김효순
 * Date: 2012-09-04
 * Time: 오후 1:35
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace 스크린세이버
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public partial class MainForm : Form
	{
		private const int WM_SYSCOMMAND = 0x112;
		private const int SC_SCREENSAVE = 0xF140;
		
		[DllImport("user32.dll")]
		private static extern IntPtr GetDesktopWindow();
		
		[DllImport("user32.dll")]
		private static extern int SendMessage(IntPtr hWnd, int wMsg, int wParam, int lParam);

		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		void Bt1Click(object sender, EventArgs e)
		{
			
			
			IntPtr dwin = GetDesktopWindow();
			SendMessage(dwin, WM_SYSCOMMAND, SC_SCREENSAVE, 0);
		}
	}
}
